package com.guw.Swing;

import javax.swing.*;
import java.awt.*;
import java.util.Vector;

public class TestComboboxDemo02 extends JFrame {
    public TestComboboxDemo02(){
        Container container = this.getContentPane();
        //生成列表的内容
        String[] contents = {"22","55","66","11","33"};
        //列表中需要放入的内容
        JList jList = new JList(contents);
        //加入容器
        container.add(jList);
        //创建一个矢量容器
        Vector contents2 = new Vector();
        //创建一个列表
        JList jList2 = new JList(contents2);
        //在列表中动态添加内容
        contents2.add("zhangsan");
        contents2.add("lisi");
        contents2.add("wangwu");
        //将列表加入容器
        container.add(jList2);

        this.setVisible(true);
        this.setBounds(100,100,300,500);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);



    }

    public static void main(String[] args) {
        new TestComboboxDemo02();
    }


}
